<template>
    <div>
        <el-dialog v-model="ViewdialogVisible" width="80%" align-center destroy-on-close draggable>
            <template #header="{ close }">
                <div class="dialog-header flex justify-between items-center">
                    <div>论文查看</div>
                    <el-icon class="el-icon--left cursor-pointer" @click="close">
                        <CircleCloseFilled color="#fff" />
                    </el-icon>
                </div>
            </template>
            <div>
                <!-- 论文信息 -->
                <div class="bg-white mt-[10px]">
                    <BaseHead>论文信息</BaseHead>
                    <div class="p-[10px]">
                        <el-descriptions title="" :column="2" border label-width="140">
                            <el-descriptions-item label-class-name="gdlable" :span="2" label="名称">{{
            xmInfo.name
        }}</el-descriptions-item>
                            <el-descriptions-item label-class-name="gdlable" label="发表/出版时间">{{
                dateFormatter3(xmInfo.publishDate)
            }}</el-descriptions-item>
                            <el-descriptions-item label-class-name="gdlable" label="所有作者"><span type="primary"
                                    v-for="(item, index) in xmInfo.authorList" :key="item.paperId">{{
            item.authorName
        }}<span
                                        v-if="index + 1 != xmInfo.authorList.length">,</span></span></el-descriptions-item>
                            <el-descriptions-item label-class-name="gdlable" label="发表/刊物论文集">{{
            xmInfo.magazineName
        }}</el-descriptions-item>
                        </el-descriptions>
                    </div>
                </div>
                <!-- 收录信息 -->
                <div class="bg-white mt-[10px]">
                    <BaseHead>收录信息</BaseHead>
                    <div class="p-[10px]">
                        <el-descriptions title="" :column="2" border label-width="140">
                            <el-descriptions-item label-class-name="gdlable" label="论文名称">{{
            xmInfo.name
        }}</el-descriptions-item>
                            <el-descriptions-item label-class-name="gdlable" label="收录日期">{{
                dateFormatter3(ruleForm.embodyDate)
            }}</el-descriptions-item>
                            <el-descriptions-item label-class-name="gdlable" label="收录类型">{{
                formatbembodyTypeId(ruleForm.embodyTypeId)
            }}</el-descriptions-item>
                            <el-descriptions-item
                                v-if="ruleForm.embodyTypeIdList && ruleForm.embodyTypeIdList.length && ruleForm.embodyTypeIdList.includes('300601')"
                                label-class-name="gdlable" label="大类分区">{{
            ruleForm.sciPartition == 1 ? '一区' : ruleForm.sciPartition == 2 ? '二区' :
                ruleForm.sciPartition == 3 ? '三区' : '四区'
                                }}</el-descriptions-item>
                            <el-descriptions-item label-class-name="gdlable" label="影响因子">{{
                                ruleForm.factor
                                }}</el-descriptions-item>
                            <el-descriptions-item label-class-name="gdlable" label="收录证明附件">
                                <div v-for="item in ruleForm.fileList" :key="item.id">{{ item.fileName
                                    }}<el-link type="primary" style="margin-left: 8px;"
                                        @click="downloadMet(item.id)">下载</el-link>
                                </div>
                            </el-descriptions-item>
                        </el-descriptions>
                    </div>
                </div>
            </div>
        </el-dialog>
    </div>
</template>
<script setup>
import BaseHead from "@/views/project/components/BaseHead.vue";
import { getpaperInfo } from "@/api/achievement/kycg"
import { getCategory } from "@/api/system/category"
const ViewdialogVisible = defineModel();
const props = defineProps({
    slList: Array,
})
const ruleForm = reactive({
});

const getRuleForm = (i) => {
    for (const key in i) {
        ruleForm[key] = i[key];
    }
    viewXm()
}
const xmInfo = ref({})
const viewXm = () => {
    getpaperInfo(ruleForm.paperId).then((res) => {
        if (res.code == 200) {
            xmInfo.value = res.data
        }
    })
    // getslTable()
};

const formatbembodyTypeId = (cellValue) => {
    if (props.slList.length && cellValue) {
        if (props.slList.find(item => item.code == cellValue)) {
            return props.slList.find(item => item.code == cellValue).name
        } else {
            return ''
        }
    } else {
        return ''
    }
}
const { proxy } = getCurrentInstance();
const downloadMet = (i) => {
    proxy.$download.common(i)
}
defineExpose({
    getRuleForm
})
</script>
<style lang="scss">
.gdlable {
    width: 140px;
}
</style>
<style scoped lang="scss">
@import url("@/views/achievement/index.scss");

:deep(.el-select--default) {


    .el-select__wrapper.is-disabled {
        background-color: #fff;
        box-shadow: 0 0 0 0px var(--el-select-disabled-border) inset;
        color: #606266;
        cursor: not-allowed;

        .el-select__selected-item {
            color: #606266;
        }
    }

    .el-select__suffix {
        display: none;
    }
}
</style>
